import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  root: './', // 项目入口文件在本配置文件同级目录下，即文件 index.html
  //base: '/api', // 浏览器地址栏中主机+端口号后面的项目名称
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    //host: 'localhost',
    //port: 7101,
    proxy: {
      '/api': {
        //target: 'https://www.xdfznh.club/zknoteb',
        target: 'http://localhost:8086/zknoteb',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, '')
      }
    }
  }
})
